import axios from 'axios';
const rootPath = '127.0.0.1:13000'


//本地调试写死路径 服务器不需要
if(process.env.NODE_ENV === 'development') {
  axios.defaults.baseURL = 'http://127.0.0.1:13000';   
}

axios.defaults.timeout = 3000;
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
axios.defaults.withCredentials = false;
export default new class Send {
    constructor() {

    }

    async get(path,params) {
      try {
        let resp = await axios.get(path,{params});
        console.log("axios get应答为 ",resp);
        return resp;
      }catch (error) {
        return {
          code : 500,
          data : {error}
        }
      }
    }

    async post(path,params) {
      try {
        let resp = await axios.get(path,{params});
        console.log("axios get应答为 ",resp);
        return resp;
      }catch (error) {
        return {
          code : 500,
          data : {error}
        }
      }
    }
}
